package com.handy.vo;

import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.io.Serializable;
import java.util.List;

/**
 * 分页返回
 *
 * @author handy
 */
@Data
public class PageVo<T> implements Serializable {
    @ApiModelProperty(value = "状态码")
    private Long code;
    @ApiModelProperty(value = "返回消息")
    private String msg;
    @ApiModelProperty(value = "总条数")
    private Long count;
    @ApiModelProperty(value = "Json参数")
    private List<T> data;

    private PageVo(List<T> list, Long count) {
        this.code = 0L;
        this.msg = "";
        this.count = count;
        this.data = list;
    }

    public static <T> PageVo<T> create(List<T> list, Long count) {
        return new PageVo<>(list, count);
    }

    public static <T> PageVo<T> create(List<T> list, Integer count) {
        return new PageVo<>(list, (long) count);
    }

}